<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create Loan Account - Mifos Spike</title>
</head>
<body>

<p><fmt:message key="loanaccount.form.customername" />: ${customerName}</p>
<p><fmt:message key="loanaccount.form.loanproducttype" />: ${loanProductName}</p>

<div>
<p><fmt:message key="loanaccount.summary.description" />: ${loanDescription}</p>
<p><fmt:message key="loanaccount.summary.interestratetype" />: <fmt:message key="${loanProductInterestRatePropertyKey}" /></p>
</div>

<form:form commandName="loanAccountForm" action="createloanaccount.htm">
    <fieldset>
    <legend><fmt:message key="loanaccount.form.legend" /></legend>
    <form:hidden path="customerId"/>
    <form:hidden path="loanProductId"/>
    
    <label for="amount">Amount:</label>
    <form:input id="amount" path="amount"/>
    </br>
    
    <label for="interest_rate">Interest Rate:</label>
    <form:input id="interest_rate" path="interestRate"/>
    </br>
    <label for="num_of_installments">Number of Installments:</label>
    <form:input id="num_of_installments" path="numOfInstallments"/>
    </br>
    <label for="disbursal_date">Disbursal date:</label>
    <form:input id="disbursal_date" path="disbursalDate"/>
    </br>
    <label for="grace_period_for_repayments">Grace Period for repayments:</label>
    <form:input id="grace_period_for_repayments" path="gracePeriodForRepayments"/>
    </br>
    <label for="source_of_fund">Source of fund:</label>
    <form:select id="source_of_fund" path="sourceOfFundId">
            <form:option value="-1" label="--Select--"/>
            <form:options items="${sourceOfFundsList}" itemValue="value" itemLabel="displayValue"/>
    </form:select>
    </br>
    <label for="purpose_of_loan">Purpose of loan:</label>
    <form:select id="purpose_of_loan" path="purposeOfLoan">
            <form:option value="-1" label="--Select--"/>
            <form:options items="${purposeOfLoansList}" itemValue="value" itemLabel="displayValue"/>
    </form:select>
    </br>
    <label for="collateral_type">Collateral type:</label>
    <form:select id="collateral_type" path="collateralType">
            <form:option value="-1" label="--Select--"/>
            <form:options items="${collateralTypesList}" itemValue="value" itemLabel="displayValue"/>
    </form:select>
    </br>
    <label for="collateral_notes">Collateral notes:</label>
    <form:textarea id="collateral_notes" path="collateralNotes" cols="50" rows="9"/>
    </br>
    <c:forEach items="${standardFees}" varStatus="standardFee">
        <label for="standard_fee${standardFee.index}">Standard Fee:</label>
    	<form:input id="standard_fee${standardFee.index}" path="standardFees[${standardFee.index}]"/>
    	</br>
    </c:forEach>
    </br>
	<input type="submit" value="<fmt:message key="loanaccount.form.submitbutton" />" />
	</fieldset>
</form:form>

</body>
</html>